import random

def generate_test_cases(num_cases=10):
    """生成测试用例"""
    test_cases = []
    
    # 添加一些特殊用例
    test_cases.extend([
        0,                  # 全0
        0xFFFFFFFF,        # 全1
        1,                 # 只有最低位为1
        0x80000000,        # 只有最高位为1
        0x55555555,        # 交替的1和0
        0xAAAAAAAA,        # 交替的0和1
        43261596,          # 示例用例
    ])
    
    # 生成随机用例
    while len(test_cases) < num_cases:
        # 生成随机32位无符号整数
        num = random.randint(0, 0xFFFFFFFF)
        if num not in test_cases:
            test_cases.append(num)
    
    return test_cases

def save_test_cases(test_cases, filename="test_cases.txt"):
    """保存测试用例到文件"""
    with open(filename, 'w') as f:
        for num in test_cases:
            f.write(f"{num}\n")
    print(f"已生成 {len(test_cases)} 个测试用例并保存到 {filename}")

def main():
    # 生成20个测试用例
    test_cases = generate_test_cases(20)
    save_test_cases(test_cases)

if __name__ == "__main__":
    main() 